import request from '@/utils/request'

// 查询仓库管理列表
export function listInventory(query) {
  return request({
    url: '/veterinary/inventory/list',
    method: 'get',
    params: query
  })
}

// 查询仓库管理详细
export function getInventory(inventoryId) {
  return request({
    url: '/veterinary/inventory/' + inventoryId,
    method: 'get'
  })
}

// 新增仓库管理
export function addInventory(data) {
  return request({
    url: '/veterinary/inventory',
    method: 'post',
    data: data
  })
}

// 修改仓库管理
export function updateInventory(data) {
  return request({
    url: '/veterinary/inventory',
    method: 'put',
    data: data
  })
}

// 删除仓库管理
export function delInventory(inventoryId) {
  return request({
    url: '/veterinary/inventory/' + inventoryId,
    method: 'delete'
  })
}

// 查询库存预警列表
export function getWarningList() {
  return request({
    url: '/veterinary/inventory/warning',
    method: 'get'
  })
}

// 查询即将过期药品列表
export function getExpiringList(days) {
  return request({
    url: '/veterinary/inventory/expiring/' + days,
    method: 'get'
  })
}

// 根据药品名称和批号查询库存
export function searchInventoryByDrugAndBatch(drugName, batchNumber) {
  return request({
    url: '/veterinary/inventory/search/' + drugName + '/' + batchNumber,
    method: 'get'
  })
}

// 获取所有库存商品（用于快速选择）
export function getAllInventoryItems() {
  return request({
    url: '/veterinary/inventory/all',
    method: 'get'
  })
}

// 根据关键词搜索库存商品
export function searchInventoryItems(keyword) {
  return request({
    url: '/veterinary/inventory/search',
    method: 'get',
    params: { keyword }
  })
}
